﻿using Microsoft.AspNetCore.Mvc;
using ProsonUser.DomainExamList;
using ProsonUser.ProsonExamDTO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;

namespace ProsonUser.ProsonExam
{
    public class PExam : ApplicationService, IExam
    {
        private readonly IRepository<Exam, int> _Exam;
        public PExam(IRepository<Exam, int> question)
        {
            _Exam = question;

        }
        //点击开始考试
        [HttpPost, Route("AddExam")]
        public async Task<int> AddExam(ExamCreateDTO dto)
        {
            dto.grade = 0;//开始考试中分数0
            dto.num = dto.num + 1; //每次比每次+1次
            dto.isnot = 0;//0进行中1已结束
            dto.etime = DateTime.Now;
            var query = await _Exam.InsertAsync(ObjectMapper.Map<ExamCreateDTO, Exam>(dto));
            return 1;
           
        }
    }
}
